{extend name="$base" /}
{block name="resources"}
<link rel="stylesheet" type="text/css" href="ADMIN_CSS/member_list.css" />
<script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script>

{/block}
{block name="main"}
<div class="space-10"></div>
<div class="set-style">
	<dl>
		<dt><span class="required">*</span>买币数量：</dt>
		<dd>
			<input type="text" id="level_name" value="{$info.buy_coin_count}" class="input-common">
			<p class="error">请输入数量</p>
			<p class="hint">设置数量</p>
		</dd>
	</dl>
	<dl>
		<dt><span class="required">*</span>小型矿机:</dt>
		<dd>
			<input type="number" id="give_small"  value="{$info.give_small}"  class="input-common">
			<p class="error">请输入数量</p>
			<p class="hint">设置数量</p>
		</dd>
	</dl>
	<dl>
		<dt><span class="required">*</span>中型矿机:</dt>
		<dd>
			<input type="number" id="give_middle"  value="{$info.give_middle}" class="input-common">
			<p class="error">请输入数量</p>
			<p class="hint">设置数量</p>
		</dd>
	</dl>
	<dl>
		<dt><span class="required">*</span>大型矿机:</dt>
		<dd>
			<input type="number" id="give_large"  value="{$info.give_large}" class="input-common">
			<p class="error">请输入数量</p>
			<p class="hint">设置数量</p>
		</dd>
	</dl>
	<dl>
		<dt><span class="required">*</span>超级矿机:</dt>
		<dd>
			<input type="number" id="give_super"  value="{$info.give_super}" class="input-common">
			<p class="error">请输入数量</p>
			<p class="hint">设置数量</p>
		</dd>
	</dl>
	<dl>
		<dt><span class="required">*</span>是否给推荐人:</dt>
		<dd>
			<input type="number" id="give_parent"  value="{$info.give_parent}" class="input-common">
			<p class="error">是否给推荐人</p>
			<p class="hint">是否给推荐人</p>
		</dd>
	</dl>
	<dl style="display: none">
		<dt><span class="required">*</span>升级等级:</dt>
		<dd>
			<input type="number" id="update_level"  value="{$info.update_level}" class="input-common">
			<p class="error">请输入升级等级</p>
			<p class="hint">设置升级等级</p>
		</dd>
	</dl>
	<dl>
		<dt></dt>
		<dd>
			<button class="btn-common btn-big" onclick="addGift();">保存</button>
			<button class="btn-common-cancle btn-big" onclick="javascript:history.back(-1);" >返回</button>
		</dd>
	</dl>
</div>
<script src="__STATIC__/js/ajax_file_upload.js" type="text/javascript"></script>
<script src="__STATIC__/js/file_upload.js" type="text/javascript"></script>
<script>
//保存
function addGift(){
	var id = {$info.id};
	var give_small = $("#give_small").val();
	var give_middle = $("#give_middle").val();
	var give_large = $("#give_large").val();
    var give_super = $("#give_super").val();
    var update_level = $("#give_super").val();
    var give_parent = $("#give_parent").val();
	$.ajax({
		type : "post",
		url : "{:__URL('ADMIN_MAIN/Mine/sendCoinModify')}",
		data : {
			'id':id,
			'give_small' : give_small,
			'give_middle' : give_middle,
			'give_large' : give_large,
            'give_super' : give_super,
			'update_level':update_level,
			'give_parent':give_parent
		},
		success : function(data) {
			if (data["code"] > 0) {
				showTip(data['message'],'success');
				location.href=__URL("ADMIN_MAIN/Mine/buyCoinSendList");
			}else{
				showTip(data['message'],'error');
			}
		}
	});
}

//图片上传
function imgUpload(event) {
    var fileid = $(event).attr("id");
    var data = { 'file_path' : UPLOADCOMMON };
    var id = $(event).next().attr("id");
    uploadFile(fileid,data,function(res){
        if(res.code){
            $("#"+id).val(res.data);
            $("#text_" + id).val(res.data);
            $("#preview_" + id).attr("data-src",__IMG(res.data));
            showTip(res.message,"success");
        }else{
            showTip(res.message,"error");
        }
    });
}
</script>
{/block}